package com.example.demo.web.rest.errors;
/**
 * @ClassName
 * @Description TODO
 * @Author jhipster
 * @Date：2020/1/10
 */
public class NestedException extends RuntimeException {
    private static final long serialVersionUID = 5893258079497055346L;
    private Throwable throwable;

    private NestedException(Throwable t) {
        this.throwable = t;
    }

    public static RuntimeException wrap(Throwable t) {
        return (RuntimeException) (t instanceof RuntimeException ? (RuntimeException) t : new NestedException(t));
    }

    @Override
    public Throwable getCause() {
        return this.throwable;
    }

    @Override
    public void printStackTrace() {
        this.throwable.printStackTrace();
    }
}
